package model;

import java.util.List;

/**
 * Un {@link Document} modélise un fichier à indexer
 */
public class Document
{
  /** The id. */
  private int id;
  
  /** The name. */
  private String name;
  
  /** The balises. */
  private List<Balise> balises;
  
  /** The emplacements. */
  private List<Emplacement> emplacements;

  /**
   * Instantiates a new document.
   *
   * @param id the id
   * @param nom the nom
   * @param balises the balises
   */
  public Document(int id, String nom, List<Balise> balises)
  {
    this.id = id;
    this.name = nom;
    this.balises = balises;
  }
  
  /**
   * Instantiates a new document with a list of emplacements.
   */
  public Document(Document doc, List<Emplacement> listEmplacement) {
    this(doc.getId(), doc.getName(), doc.getBalises());
    emplacements = listEmplacement;
  }

  /**
   * Gets the id of the document in the database
   *
   * @return the id
   */
  public int getId()
  {
    return id;
  }

  /**
   * Gets the name.
   *
   * @return the name
   */
  public String getName()
  {
    return name;
  }
  
  /**
   * Adds a balise to the list of balises that document contains
   *
   * @param balise the balise to ass
   */
  public void addBalise(Balise balise)
  {
    balises.add(balise);
  }

  /**
   * Gets the balises.
   *
   * @return the balises
   */
  public List<Balise> getBalises()
  {
    return balises;
  }
  
  /**
   * Gets the emplacements.
   * 
   * @return the emplacements.
   */
  public List<Emplacement> getEmplacements() {
    return emplacements;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String toString()
  {
    return this.name;
  }
}
